<?php use_helper('yougoDate', 'Date') ?>

<?php slot('title', __('My Requests')) ?>
<?php slot('options') ?>
    <?php include_partial('pageLinks', array('route' => 'requests_index_page', 'page' => $page)) ?>
<?php end_slot() ?>

<table class="calendar">
    <thead>
        <?php include_partial('calendarHeader', array('calendar' => $calendar, 'admin' => false)) ?>
    </thead>
    <tbody>
        <?php include_partial('calendarRequestsLine', array(
                'calendar'      => $calendar,
                'requests'      => $calendarRequests,
                'admin'    => false)) ?>
    </tbody>
</table>

<table class="listing">
    <thead>
        <tr>
            <th><?php echo __('Id') ?></th>
            <th><?php echo __('Type') ?></th>
            <th><?php echo __('From') ?></th>
            <th><?php echo __('To') ?></th>
            <th><?php echo __('Ask Comment') ?></th>
            <th><?php echo __('Answer Comment') ?></th>
            <th><?php echo __('Status') ?></th>
            <th class="actions"><?php echo __('Actions') ?></th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($requests as $request): ?>
        <tr>
            <td><?php echo $request->getId() ?></td>
            <td><?php echo $requestTypes[$request->getTypeId()] ?></td>
            <td><?php echo format_date($request->from) ?></td>
            <td><?php echo format_date($request->to) ?></td>
            <td><?php echo $request->getAskComment() ?></td>
            <td><?php echo $request->getAnswerComment() ?></td>
            <td><?php echo __($request->getStatus()) ?></td>
            <td class="actions">
                <?php if ($request->isPending()): ?>
                    <a href="<?php echo url_for('requests/edit?id='.$request->getId()) ?>"><img src="/sf/sf_admin/images/edit.png" alt="edit" /></a>
                    <?php echo link_to('<img src="/sf/sf_admin/images/cancel.png" alt="delete" />', 'requests/delete?id='.$request->getId(), array('method' => 'delete', 'confirm' => __('Are you sure?'))) ?>
                <?php endif; ?>
            </td>
        </tr>
        <?php endforeach ?>
    </tbody>
</table>